<!DOCTYPE html>
<html lang="en" xmlns:th="https://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
<!-- 引入公共组件 -->
<div th:replace="common/common::html"></div>
<head>
    <meta charset="UTF-8">
    <!-- 引入基础样式与脚本 -->
    <link th:href="@{/assets/css/page.css}" rel="stylesheet"/>
    <script th:src="@{/assets/grid/js/jquery.flexigrid.js}"></script>
    <!-- 引入zTree相关资源（文件树与拖拽功能） -->
    <link th:href="@{/assets/zTree3.3/css/zTreeStyle/zTreeStyle.css}" rel="stylesheet" type="text/css">
    <script th:src="@{/assets/zTree3.3/js/jquery.ztree.core-3.5.min.js}"></script>
    <script th:src="@{/assets/zTree3.3/js/jquery.ztree.exedit-3.5.min.js}"></script>
    <title th:text="#{file.manager.title}">文件管理</title>
    <script th:inline="javascript">
        // 【补丁：补全zTree isChildNode方法】
        (function () {
            const originalGetZTreeObj = $.fn.zTree.getZTreeObj;
            $.fn.zTree.getZTreeObj = function (treeId) {
                const zTree = originalGetZTreeObj.call(this, treeId);
                if (typeof zTree.isChildNode !== 'function') {
                    zTree.isChildNode = function (node, parentNode) {
                        while (node && node.parentNode) {
                            if (node.parentNode.tId === parentNode.tId) return true;
                            node = node.parentNode;
                        }
                        return false;
                    };
                }
                return zTree;
            };
        })();

        // 常量定义
        const FILE_TYPE_FILE = 0;
        const FILE_TYPE_FOLDER = 1;
        var _gridWidth;
        var _gridHeight;

        // zTree配置（文件树与拖拽功能）
        var zTreeSetting = {
            edit: {
                enable: true,
                drag: {
                    enable: true,       // 启用拖拽
                    isMove: true,       // 移动模式（源节点删除）
                    isCopy: false,      // 禁用复制
                    inner: true         // 允许拖入文件夹内部
                },
                showRemoveBtn: false,
                showRenameBtn: false
            },
            data: {
                simpleData: {
                    enable: true,
                    idKey: "fileUuid",  // 文件唯一标识
                    pIdKey: "parentUuid" // 父文件夹标识
                },
                key: {
                    name: "fileName"    // 节点显示名称
                }
            },
            callback: {
                beforeDrop: zTreeBeforeDrop,  // 拖拽前校验
                onDrop: zTreeOnDrop          // 拖拽后处理
            }
        };

        // 页面自适应
        function resizePageSize() {
            _gridWidth = $(document).width() - 12; /* 避免滚动条折行问题 */
            _gridHeight = $(document).height() - 65 - 40; /* 减去顶部菜单和查询区高度 */
        }

        // 加载文件树
        function loadFileTree() {
            $.ajax({
                url: /*[[@{/file/queryAllFileTree}]]*/ '',
                type: 'get',
                dataType: 'json',
                success: function (data) {
                    console.log("文件树数据：", data);
                    if (!data || data.length === 0) {
                        alert("没有文件数据，请先同步或上传文件");
                        return;
                    }
                    $.fn.zTree.init($("#fileTree"), zTreeSetting, data);
                    console.log("zTree拖拽状态：", zTreeSetting.edit.drag.enable);
                },
                error: function (xhr) {
                    console.error("文件树加载失败，状态码：", xhr.status);
                    console.error("响应内容：", xhr.responseText);
                    alert("文件树加载失败，请检查接口");
                }
            });
        }

        // 拖拽前校验
        function zTreeBeforeDrop(treeId, treeNodes, targetNode, moveType) {
            console.log("待拖节点类型：", treeNodes[0].fileType);
            console.log("目标节点类型：", targetNode?.fileType);
            if (!targetNode) {
                alert("目标节点不存在");
                return false;
            }
            const zTree = $.fn.zTree.getZTreeObj(treeId);
            // 禁止拖到自身或子文件夹
            if (targetNode === treeNodes[0] || zTree.isChildNode(targetNode, treeNodes[0])) {
                alert("不能拖动到自身或子文件夹中");
                return false;
            }
            return true;
        }

        // 拖拽后处理（移动文件）
        function zTreeOnDrop(event, treeId, treeNodes, targetNode) {
            if (!targetNode || !targetNode.isParent) {
                alert("只能拖到文件夹内！");
                return;
            }
            const fileUuids = treeNodes.map(node => node.fileUuid).join(",");
            const targetFolderUuid = targetNode.fileUuid;
            const zTree = $.fn.zTree.getZTreeObj(treeId);
            zTreeSetting.edit.drag.enable = false; // 禁用拖拽防止重复提交
            $.ajax({
                url: /*[[@{/file/moveFiles}]]*/ '',
                type: 'post',
                data: { fileUuids: fileUuids, targetFolderUuid: targetFolderUuid },
                dataType: 'json',
                success: function (response) {
                    if (response.success) {
                        treeNodes.forEach(node => zTree.removeNode(node));
                        query(); // 刷新列表
                        alert("文件移动成功");
                    } else {
                        alert("移动失败: " + response.msg);
                    }
                },
                error: function () {
                    alert("移动接口调用失败");
                },
                complete: function () {
                    zTreeSetting.edit.drag.enable = true; // 恢复拖拽
                }
            });
        }

        // 打开重命名对话框（文档2新增功能）
        function renameFile(fileUuid, currentName) {
            // 保存当前要重命名的文件UUID
            $("#rename-file-uuid").val(fileUuid);
            // 填充当前文件名到输入框
            $("#new-file-name").val(currentName);
            // 显示重命名对话框
            $("#rename-file-dialog-id").dialog('open');
        }

        // 确认重命名操作（文档2新增功能）
        function confirmRename() {
            const fileUuid = $("#rename-file-uuid").val();
            const newFileName = $("#new-file-name").val().trim();
            // 验证文件名不为空
            if (!newFileName) {
                alert("文件名不能为空");
                return;
            }
            // 发送重命名请求到后端
            $.ajax({
                url: /*[[@{/file/renameFile}]]*/ '',
                type: 'post',
                data: {
                    fileUuid: fileUuid,
                    newFileName: newFileName
                },
                dataType: 'json',
                success: function (response) {
                    if (response.success) {
                        alert("文件重命名成功");
                        // 关闭对话框
                        $("#rename-file-dialog-id").dialog('close');
                        // 刷新文件列表和文件树
                        query();
                        loadFileTree();
                    } else {
                        alert("重命名失败: " + response.msg);
                    }
                },
                error: function () {
                    alert("重命名接口调用失败");
                }
            });
        }

        // 页面初始化
        $(function () {
            resizePageSize();
            const _columnWidth = (_gridWidth - 150) / 4;
            // 初始化文件列表表格（flexigrid）
            $("#flexigrid-id").flexigrid({
                width: _gridWidth,
                height: _gridHeight,
                url: /*[[@{/file/queryFileInfoListByPage}]]*/ '',
                dataType: 'json',
                colModel: [
                    { display: 'fileUuid', name: 'fileUuid', width: 150, sortable: false, align: 'center', hide: 'true' },
                    {
                        display: /*[[#{file.name}]]*/ '文件名称',
                        name: 'fileName',
                        width: _columnWidth,
                        sortable: true,
                        align: 'center',
                        process: function (v, _trid, _row) {
                            let html = `<div style="display: flex; width: 100px;">`;
                            if (_row.fileType === FILE_TYPE_FOLDER) {
                                html += `<a href="#" style="color: #f7ba2a" class="btn" onclick="enterDir('${_row.fileUuid}','${_row.filePath}')">
                                            <i class="glyphicon glyphicon-folder-close" style="margin-right: 5px"></i>
                                            <span>${v}</span>
                                        </a>`;
                            } else {
                                html += `<a href="#" style="color: #00b1ef" class="btn" onclick="preFile('${_row.fileUuid}','${v}')">
                                            <i class="glyphicon glyphicon-file" style="margin-right: 5px"></i>
                                            <span>${v}</span>
                                        </a>`;
                            }
                            html += `</div>`;
                            return html;
                        }
                    },
                    { display: /*[[#{file.size}]]*/ '文件大小', name: 'fileCapacity', width: _columnWidth, sortable: true, align: 'center' },
                    { display: /*[[#{file.last.time}]]*/ '最后修改时间', name: 'modtime', width: _columnWidth, sortable: true, align: 'center' },
                    {
                        display: /*[[#{common.operation}]]*/ '操作',
                        name: 'fileUuid',
                        width: _columnWidth,
                        sortable: true,
                        align: 'center',
                        process: function (v, _trid, _row) {
                            let html = `<div>`;
                            // 文件操作（重命名、删除、下载、分享）
                            if (_row.fileType === FILE_TYPE_FILE) {
                                // 重命名按钮（带权限控制）
                                if ([[${#authorization.expression("hasRole('ROLE_cldk_data_user_mod')")}]]) {
                                    html += `<a href="#" class="btn" onclick="renameFile('${v}', '${_row.fileName}')" title="重命名">
                                                <i class="glyphicon glyphicon-pencil"></i>
                                            </a>`;
                                }
                                // 删除到回收站（文档1独有功能）
                                html += `<a href="#" class="btn text-danger" onclick="deleteToRecycle('${v}')" title=[[#{common.delete}]]>
                                            <i class="glyphicon glyphicon-trash"></i>
                                        </a>`;
                                // 下载
                                const downUrl = /*[[@{/file/downFile}]]*/ '' + "/" + v;
                                html += `<a href="${downUrl}" class="btn" title=[[#{file.download.btn}]] target="_blank">
                                            <i class="glyphicon glyphicon-download"></i>
                                        </a>`;
                                // 分享
                                html += `<a href="#" class="btn" onclick="shareFileInfo('${v}','${_row.fileName}')" title=[[#{file.share.btn}]]>
                                            <i class="glyphicon glyphicon-share"></i>
                                        </a>`;
                            } else {
                                // 文件夹操作（重命名、删除）
                                if ([[${#authorization.expression("hasRole('ROLE_cldk_data_user_mod')")}]]) {
                                    html += `<a href="#" class="btn" onclick="renameFile('${v}', '${_row.fileName}')" title="重命名">
                                                <i class="glyphicon glyphicon-pencil"></i>
                                            </a>`;
                                }
                                // 文件夹删除到回收站
                                html += `<a href="#" class="btn text-danger" onclick="deleteToRecycle('${v}')" title=[[#{common.delete}]]>
                                            <i class="glyphicon glyphicon-trash"></i>
                                        </a>`;
                            }
                            html += `</div>`;
                            return html;
                        }
                    }
                ],
                resizable: false,
                useRp: true,
                usepager: true,
                autoload: true,
                hideOnSubmit: true,
                showcheckbox: true,
                rowbinddata: true
            });

            // 初始化文件树
            loadFileTree();

            // 初始化创建文件夹弹窗
            $("#mkdir-dialog-id").dialog({
                autoOpen: false,
                width: 400,
                modal: true,
                resizable: false,
                title: /*[[#{file.mkdir.dialog.tip}]]*/ '创建文件夹',
                buttons: [
                    {
                        text: /*[[#{common.confirm}]]*/ '确认',
                        click: function () {
                            const parentId = $('#file-folder-id').attr('parent-id');
                            const folderName = $("#file-folder-name-id").val();
                            if (!folderName) {
                                alert("文件夹名称不能为空");
                                return;
                            }
                            $.ajax({
                                type: 'post',
                                dataType: 'json',
                                url: /*[[@{/file/mkdirFileInfo}]]*/ '',
                                data: { parentId: parentId, folderName: folderName },
                                success: function (data) {
                                    alert(data.msg);
                                    query();
                                    loadFileTree(); // 同步文件树
                                    $("#file-folder-name-id").val('');
                                    $(this).dialog('close');
                                },
                                error: function () {
                                    alert("创建文件夹失败");
                                }
                            });
                        }
                    },
                    {
                        text: /*[[#{common.cancel}]]*/ '取消',
                        click: function () {
                            $(this).dialog('close');
                        }
                    }
                ]
            });

            // 初始化上传文件弹窗
            $("#upload-file-dialog-id").dialog({
                autoOpen: false,
                width: 400,
                modal: true,
                resizable: false,
                title: /*[[#{file.upload.dialog.tip}]]*/ '上传文件',
                buttons: [
                    {
                        text: /*[[#{common.confirm}]]*/ '确认',
                        click: function () {
                            const fileInput = $("#upload-file-name-id")[0];
                            if (!fileInput.files.length) {
                                alert("请选择文件");
                                return;
                            }
                            $("#upload-file-form-id").submit();
                        }
                    },
                    {
                        text: /*[[#{common.cancel}]]*/ '取消',
                        click: function () {
                            $(this).dialog('close');
                        }
                    }
                ]
            });

            // 配置上传表单异步提交
            $("#upload-file-form-id").ajaxForm({
                dataType: "json",
                success: function (data) {
                    alert(data.msg);
                    query();
                    loadFileTree(); // 同步文件树
                    $("#upload-file-dialog-id").dialog('close');
                },
                error: function () {
                    alert("文件上传失败");
                }
            });

            // 初始化重命名文件弹窗（文档2新增）
            $("#rename-file-dialog-id").dialog({
                autoOpen: false,
                width: 400,
                modal: true,
                resizable: false,
                title: "重命名文件",
                buttons: [
                    {
                        text: /*[[#{common.confirm}]]*/ '确认',
                        click: confirmRename
                    },
                    {
                        text: /*[[#{common.cancel}]]*/ '取消',
                        click: function () {
                            $(this).dialog('close');
                        }
                    }
                ]
            });

            // 初始化分享文件弹窗
            $("#share-file-dialog-id").dialog({
                autoOpen: false,
                width: 800,
                modal: true,
                resizable: false,
                title: /*[[#{file.share.dialog.tip}]]*/ '文件分享',
                buttons: [
                    {
                        text: /*[[#{common.confirm}]]*/ '确认',
                        click: function () {
                            $(this).dialog('close');
                        }
                    }
                ]
            });

            // 初始化文档预览弹窗
            $("#pre-document-dialog-id").dialog({
                autoOpen: false,
                width: 800,
                modal: true,
                resizable: false,
                title: /*[[#{file.preview.title}]]*/ '文档预览',
                buttons: [
                    {
                        text: /*[[#{common.confirm}]]*/ '确认',
                        click: function () {
                            $(this).dialog('close');
                        }
                    }
                ]
            });
        });

        // 文件同步
        function syncFileData() {
            $.ajax({
                type: 'post',
                dataType: 'json',
                url: /*[[@{/file/syncFileData}]]*/ '',
                success: function (data) {
                    alert(data.msg);
                    loadFileTree(); // 同步文件树
                    query(); // 刷新列表
                },
                error: function () {
                    alert("同步失败");
                }
            });
        }

        // 查询文件列表（保留文档1的文件名搜索功能）
        function query() {
            const parentId = $("#file-folder-id").attr("parent-id");
            const fileName = $("#file-query-input").val().trim(); // 支持文件名搜索
            $("#flexigrid-id").flexOptions({
                extParam: [
                    { name: "parentId", value: parentId },
                    { name: "fileName", value: fileName }
                ]
            }).flexReload();
        }

        // 进入文件夹
        function enterDir(fileUuid, filePath) {
            $("#file-folder-id").attr("parent-id", fileUuid);
            $.ajax({
                type: 'post',
                dataType: 'json',
                url: /*[[@{/file/queryFileInfoById}]]*/ '',
                data: { fileUuid: fileUuid },
                success: function (data) {
                    $("#file-folder-id").val(data ? data.filePath : "/");
                    query();
                },
                error: function () {
                    alert("进入文件夹失败");
                }
            });
        }

        // 返回上级目录
        function upDir() {
            const fileUuid = $("#file-folder-id").attr("parent-id");
            $.ajax({
                type: 'post',
                dataType: 'json',
                url: /*[[@{/file/queryFileInfoById}]]*/ '',
                data: { fileUuid: fileUuid },
                success: function (data) {
                    if (data) {
                        enterDir(data.parentUuid);
                    } else {
                        $("#file-folder-id").val("/").attr("parent-id", "-1");
                        query();
                    }
                },
                error: function () {
                    alert("返回上级失败");
                }
            });
        }

        // 创建文件夹
        function mkdirFun() {
            $("#mkdir-dialog-id").dialog('open');
        }

        // 上传文件
        function uploadFile() {
            $("#upload-file-parent-id").val($("#file-folder-id").attr("parent-id"));
            $("#upload-file-dialog-id").dialog('open');
        }

        // 文件复制
        function copyFile() {
            const ids = $("#flexigrid-id").getFlexigridiAttrByIndex(0);
            if (ids.length === 0) {
                alert(/*[[#{common.empty}]]*/ '请选择文件');
                return;
            }
            $("#file-copy-btn-id").attr('ids', ids);
            const parentId = $("#file-folder-id").attr("parent-id");
            $("#file-copy-btn-id").attr('src-uuid', parentId);
            $("#file-past-btn-id").removeClass('hidden');
            $("#file-past-num-id").text(ids.length + "");
        }

        // 文件粘贴
        function pasteFile() {
            const parentId = $("#file-folder-id").attr("parent-id");
            const srcUuid = $("#file-copy-btn-id").attr('src-uuid');
            if (parentId === srcUuid) {
                alert(/*[[#{file.paste.fail.same.folder}]]*/ "不能粘贴到原文件夹");
                return;
            }
            const ids = $("#file-copy-btn-id").attr('ids');
            $.ajax({
                type: 'post',
                dataType: 'json',
                url: /*[[@{/file/copyFile}]]*/ '',
                data: { srcUuidList: ids, parentId: parentId },
                success: function (data) {
                    alert(data.msg);
                    if (data.success) {
                        $("#file-past-btn-id").addClass("hidden");
                        query();
                        loadFileTree(); // 同步文件树
                    }
                },
                error: function () {
                    alert(/*[[#{common.error}]]*/ '操作失败');
                }
            });
        }

        // 将文件移至回收站（文档1独有功能）
        function deleteToRecycle(fileUuid) {
            $.ajax({
                type: 'post',
                dataType: 'json',
                url: /*[[@{/file/deleteToRecycle}]]*/ '',
                data: { fileUuid: fileUuid },
                success: function (data) {
                    alert(data.msg);
                    if (data.success) {
                        query();
                        loadFileTree(); // 同步文件树
                    }
                },
                error: function () {
                    alert(/*[[#{common.error}]]*/ '删除失败');
                }
            });
        }

        // 文件分享
        function shareFileInfo(fileUuid, fileName) {
            $("#share-file-name").attr("fileUuid", fileUuid);
            $("#share-file-name").text(fileName);
            $("#share-file-dialog-id").dialog('open');
        }

        // 查询分享链接
        function queryShareUrl() {
            const fileUuid = $("#share-file-name").attr("fileUuid");
            const fileValidity = $("#share-file-validity").val();
            $.ajax({
                type: 'post',
                dataType: 'json',
                url: /*[[@{/file/queryShareUrl}]]*/ '',
                data: { fileUuid: fileUuid, fileValidity: fileValidity },
                success: function (data) {
                    $("#share-file-url-id").val(data['code']);
                },
                error: function () {
                    alert(/*[[#{common.error}]]*/ '获取分享链接失败');
                }
            });
        }

        // 文档预览（仅支持docx）
        function preFile(fileUuid, fileName) {
            const regDoc = new RegExp("^.*docx$");
            if (regDoc.test(fileName)) {
                $.ajax({
                    type: 'post',
                    dataType: 'json',
                    url: /*[[@{/file/getShareUrl}]]*/ '',
                    data: { fileUuid: fileUuid },
                    success: function (data) {
                        let url = data['code'];
                        if (url) {
                            url = url.replaceAll("&", "%26").replaceAll("?", "%3F");
                            $("#pro-document-iframe-id").attr("src", "https://view.xdocin.com/xdoc?_xdoc=" + url);
                        }
                        $("#pre-document-dialog-id").dialog('option', 'title', fileName);
                        $("#pre-document-dialog-id").dialog('open');
                    },
                    error: function () {
                        alert(/*[[#{common.error}]]*/ '预览失败');
                    }
                });
            } else {
                alert("仅支持docx文件预览");
            }
        }
    </script>
    <style>
        a.hidden {
            display: none;
        }
        #file-past-num-id {
            color: #ff0000;
        }
        /* 统一输入框样式（保留文档1的详细样式） */
        .header-input {
            width: 220px;
            padding: 6px 12px;
            border: 1px solid #ccc;
            border-radius: 4px;
            font-size: 14px;
            display: inline-block;
            margin-right: 8px;
            box-sizing: border-box;
        }
        .header-input:focus {
            border-color: #66afe9;
            outline: 0;
            box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, .6);
        }
        /* 调整按钮与输入框的对齐方式 */
        header .btn {
            vertical-align: middle;
            margin-left: 5px;
        }
        /* 删除按钮样式 */
        .btn.text-danger {
            color: #d9534f;
        }
        .btn.text-danger:hover {
            color: #c9302c;
            background-color: #f5f5f5;
        }
        /* 左右布局样式（整合文档2的容器类） */
        .container {
            display: flex;
            margin-top: 10px;
            gap: 10px;
        }
        .file-tree-container {
            width: 30%;
            border: 1px solid #ddd;
            height: 500px;
            overflow: auto;
        }
        .file-list-container {
            width: 70%;
        }
    </style>
</head>
<body>
<header>
    <!-- 搜索框（保留文档1的搜索功能） -->
    <input type="text"
           class="header-input form-control"
           id="file-query-input"
           th:placeholder="#{file.query.placeholder}">
    <a href="#" class="btn-info btn" onclick="query()">
        <i class="glyphicon glyphicon-search"></i>
        <span th:text="#{common.query}">查询</span>
    </a>
    <!-- 路径显示框 -->
    <input id="file-folder-id"
           value="/"
           parent-id="-1"
           class="header-input form-control"
           readonly>
    <a href="#" class="btn-info btn" onclick="upDir()" th:title="#{file.up.folder}">
        <i class="glyphicon glyphicon-open"></i>
    </a>
    <!-- 功能按钮 -->
    <a href="#" class="btn-info btn" onclick="syncFileData()">
        <i class="glyphicon glyphicon-refresh"></i>
        <span th:text="#{file.sync.data}">同步文件</span>
    </a>
    <a href="#" class="btn-info btn" onclick="mkdirFun()">
        <i class="glyphicon glyphicon-book"></i>
        <span th:text="#{file.mkdir}">新建文件夹</span>
    </a>
    <a href="#" class="btn-info btn" onclick="uploadFile()">
        <i class="glyphicon glyphicon-cloud-upload"></i>
        <span th:text="#{file.upload.btn}">上传文件</span>
    </a>
    <a id="file-copy-btn-id" href="#" class="btn-info btn" onclick="copyFile()">
        <i class="glyphicon glyphicon-copy"></i>
        <span th:text="#{file.copy.btn}">复制</span>
    </a>
    <a id="file-past-btn-id" href="#" class="btn-info btn hidden" onclick="pasteFile()">
        <i class="glyphicon glyphicon-paste"></i>
        <span th:text="#{file.paste.btn}">粘贴</span>
        (<span id="file-past-num-id"></span>)
    </a>
</header>
<!-- 左侧文件树 + 右侧文件列表布局 -->
<div class="container">
    <div class="file-tree-container">
        <ul id="fileTree" class="ztree"></ul>
    </div>
    <div class="file-list-container">
        <table id="flexigrid-id"></table>
    </div>
</div>
<!-- 创建文件夹弹窗 -->
<div id="mkdir-dialog-id" style="display: none">
    <div class="form-group">
        <span th:text="#{file.folder.name}">文件夹名称</span>
        <input id="file-folder-name-id" class="form-control" pattern="^.+$">
    </div>
</div>
<!-- 上传文件弹窗 -->
<div id="upload-file-dialog-id" style="display: none">
    <form id="upload-file-form-id" enctype="multipart/form-data" method="post" th:action="@{/file/uploadFile}">
        <input name="parentId" id="upload-file-parent-id" type="hidden">
        <div class="form-group">
            <span th:text="#{file.name}">文件名称</span>
            <input name="fileName" id="upload-file-name-id" pattern="^.+$" type="file">
        </div>
    </form>
</div>
<!-- 重命名文件弹窗（文档2新增） -->
<div id="rename-file-dialog-id" style="display: none">
    <input type="hidden" id="rename-file-uuid">
    <div class="form-group">
        <span>新文件名：</span>
        <input id="new-file-name" class="form-control" pattern="^.+$" required>
    </div>
</div>
<!-- 分享文件弹窗 -->
<div id="share-file-dialog-id" style="display: none">
    <div class="form-group">
        <span th:text="#{file.name}">文件名称</span>
        <span class="form-control" id="share-file-name"></span>
    </div>
    <div class="form-group">
        <span th:text="#{file.share.validity}">有效期（天）</span>
        <input class="form-control" id="share-file-validity" type="number" value="1" onchange="queryShareUrl()">
    </div>
    <div class="form-group">
        <span th:text="#{file.share.url}">分享链接</span>
        <textarea class="form-control" id="share-file-url-id" style="height: 60px"></textarea>
    </div>
</div>
<!-- 文档预览弹窗 -->
<div id="pre-document-dialog-id" style="display: none">
    <iframe id="pro-document-iframe-id" style="width: 100%; height: 400px"></iframe>
</div>
</body>
</html>